<template>
  <div class="PublicHead">
    <div class="content">
      <div class="left" @click="toHomepage()">
        <img src="../assets/img/logo.png" alt="">
      </div>
      <div class="right1" >
       <p>服务热线：0931-5111299</p>
       <p style="cursor: pointer;" @click="tologin">登录</p>
       <p>/</p>
       <p style="cursor: pointer;" @click="toregister">注册</p>
      </div>

    </div>
  </div>
</template>

<script>
import { user_renzheng } from '@/api/api';
export default {
  data(){
    return{
      isregister:'',
      userInfo:{
       isrenzhen:''
      }
    }
  },
  mounted(){
    if(localStorage.getItem('token')){
      const parts = localStorage.getItem('token').split('.');
      const decodedPayload = JSON.parse(atob(parts[1]));
      this.userInfo =decodedPayload
      user_renzheng({id:this.$store.state.userId}).then((res)=>{
       if(res.data.state=='20000'){
        this.isrenzhen=res.data.data.authentication_state
       }
      })
    }
    this.isregister=localStorage.getItem('isregister')
  },
methods:{
  
  toregister(){
    this.$router.push('/register');
  },
  tologin(){
    this.$router.push('/login');
    location.reload()
  },
  toHomepage(){
    this.$router.push('/login');
  },
  toRenzhen(){
    this.$router.push('/qiyerenzhen');
  },
  isrenzhen(){
   return localStorage.getItem('token') ?true:false
  },
  handleCommand(command) {
    if (command === 'changePassword') {
      // 处理修改密码逻辑
      console.log(1);
    } else if (command === 'logout') {
      // 处理退出登录逻辑
      localStorage.clear()
      this.$router.push('/login');
      this.$store.commit('setuserId', '')
      this.$message({
          message: '退出登录成功',
          type: 'success',
        });
    }
  }
}
}
</script>

<style scoped lang="scss">
.el-dropdown-link{
  color: #1285D7;
}
.PublicHead{
  height: 90px;
  background: #F8F8F8;
  width: 100%;
}
.content{
width: 1220px;
height: 100%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
}
.left{
  img{
  width: 465px;
  height:62px ;
  cursor: pointer;
  }
}
.right{
  display: flex;

}
.right1{
  display: flex;
  text-align: center;
  p{
    width: 50px;
  }
  p:nth-of-type(1){
    width: 100%;
height: 16px;
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: bold;
color: #007EC5;
  }

}
.userInfo{
.userInfoTop{
  width: 172px;
height: 17px;
font-size: 15px;
font-family: Arial;
font-weight: 400;
color: #1285D7;
line-height: 20px;
  display: flex;
  margin-bottom: 10px;
  p:nth-of-type(1){
    margin-right: 5px;
  }
}
.userInfoFoot{
  width: 172px;
height: 17px;
font-size: 15px;
font-family: Arial;
font-weight: 400;
color: #1285D7;
  display: flex;
  p:nth-of-type(1){
    width: 71px;
height: 26px;
border: 1px solid #F39800;
border-radius: 5px 5px 5px 5px;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: bold;
color: #F39800;
text-align: center;
line-height: 26px;
margin-right: 10px;
  }
  p:nth-of-type(2){
    width: 42px;
height: 12px;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: bold;
color: #E9422D;
line-height: 28px;
  }
}
}
.headPortrait{
  margin-right: 10px;
  img{
    width: 69px;
   height: 69px;
  }
}

</style>